import React, { Component } from 'react';
import { withRouter } from 'react-router-dom'
import { connect } from 'react-redux'
import '../css/style.css'

class Login extends Component {
    getLoginResult = ()=>{
         alert('a')
    }

      getElementsByClassName =(n)=> {
        var classElements = [],allElements = document.getElementsByTagName('*');
        for (var i=0; i< allElements.length; i++ )
       {
           if (allElements[i].className == n ) {
               classElements[classElements.length] = allElements[i];
            }
       }
       return classElements;
    }
    componentDidMount(){
        debugger
      let el=  this.getElementsByClassName('loginbox');
      
       
      //document.getElementById('root').style.height =  el[0].clientHeight+'px'
     // alert(document.getElementById('root'))
    }
   
    render() {
        return (
            <div className='loginbox'>
                <div className='user'>
                    <div className='center'>
                         <input className='pd10' autoFocus="autofocus" tabIndex='1' placeholder='请输入用户名' />
                    </div>
                    <div className='center'>       
                         <input className='pd10' tabIndex='2' type='password' placeholder='请输入密码' />
                    </div>
                    <div className='center'>       
                    <input className='' tabIndex='3' type='button' value='登陆' onClick={this.getLoginResult}  className='subbtn'/>
                    </div>
                </div>
                <div style={{...styles}}>
11
                </div>
                <div style={{...styles}}>
1
                </div>
              
            </div>
        );
    }
}
let styles = {
    background: '#0085ff',
    width: '100%',
     height: '5rem',
    //lineHeight: '40px',
    textAlign: 'center',
   // color:'#888'
}
const mapStateToProps = (state) => ({
    errorMessage: state.errorMessage
    
  })
export default withRouter(connect(mapStateToProps)(Login))
 